#pragma once
#ifndef __EDITOR__SETTINGS__DIALOG__HH__
#define __EDITOR__SETTINGS__DIALOG__HH__

#include "ui_SettingsDialog.h"
#include <qgroupbox.h>
#include <qformlayout.h>
#include <qpushbutton.h>
#include <LitEditorMetaObject.h>

namespace Lit
{
	namespace Editor
	{
		class LIT_API Instance;
		class LIT_API SettingsDialog : public QDialog
		{
		protected:
			Ui::SettingsDialog ui;
		protected slots:
			void ogreConfigured( const std::string &page, const std::string &name, const std::string &val );
		public:
			
			static SettingsMap ConfigureOgre( QWidget * parent, Instance* instance, const std::string &title = "Ogre Settings" );
			static SettingsMap ConfigureApplication( QWidget * parent = NULL, const std::string &title = "Application Settings" );
			
			SettingsDialog( QWidget * parent = NULL )
				: QDialog( parent )
			{ 
				ui.setupUi( this ); 
			}
			~SettingsDialog( )
			{}

			SettingsMap exec( const SettingsMap& settings, const std::string &title = "" )
			{
				ui.retranslateUi( this );
				if( !title.empty() )
					setWindowTitle( TO_QT(title) );
				SettingsTableWidget * table = ui.SettingsTab->addPage( "General");
				table->setupUi( settings );
				
				if( QDialog::exec() == QDialog::Rejected )
					return settings;
				return table->getSettings();
			}
		};
	};
};

#endif